package net.coolskill.demo.springboot.service;

import java.util.UUID;

import net.coolskill.demo.springboot.aop.ProfilerMonitor;
import net.coolskill.demo.springboot.model.UserInfo;
import org.springframework.stereotype.Component;

@Component
public class UserService {

    @ProfilerMonitor
    public UserInfo getUserInfo() throws Exception {
        Thread.sleep(1000);
        return buildUserInfo();
    }

    @ProfilerMonitor
    public UserInfo buildUserInfo() {
        UserInfo userInfo = new UserInfo();
        userInfo.setName(UUID.randomUUID().toString());
        userInfo.setAge((int)(System.currentTimeMillis() % Integer.MAX_VALUE));
        return userInfo;
    }

}
